package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.StrategyCollect;
import cn.wolfcode.trip.base.domain.TravelCollect;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.IStrategyCollectService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/strategycollect")
public class StrategyCollectController {
    @Autowired
    private IStrategyCollectService strategyCollectService;

    @GetMapping("/getCollectByUserId/{userId}")
    public Object getCollectByUserId(@PathVariable Long userId, Long strategyId, Long state) {
        StrategyCollect strategyCollect = strategyCollectService.getCollectByUserId(userId, strategyId, state);
        return strategyCollect;
    }
    @PostMapping("/{userId}")
    public Object selectCollect(@PathVariable Long userId,Long strategyId){
        boolean flag = strategyCollectService.selectCollect(userId,strategyId);
        return flag;
    }
    @GetMapping("/{strategyId}")
    public Object getCollectNumsByStrategyId(@PathVariable Long strategyId){
        Integer nums = strategyCollectService.getCollectNumsByStrategyId(strategyId);
        return nums;
    }
    @GetMapping("/query/{userId}")
    public Object query(QueryObject qo, @PathVariable Long userId){
        PageInfo<StrategyCollect> pageInfo=strategyCollectService.query(qo,userId);
        return pageInfo;
    }

}
